from django.contrib import admin

from .models import LiveRoom, Gift, ReceiveGift, RoomUserList, Label, SonLabel


# Register your models here.


class LiveRoomAdmin(admin.ModelAdmin):
    list_display = ['user', 'name', 'number', 'is_active', 'is_open', 'label']
    search_fields = ['user', 'name', 'number']
    list_filter = ['is_active']


class GiftAdmin(admin.ModelAdmin):
    list_display = ['name', 'money', 'contribution', 'info']
    search_fields = ['name']
    list_filter = ['money', 'contribution']


class ReceiveGiftAdmin(admin.ModelAdmin):
    list_display = ['gift', 'live_room', 'num']
    search_fields = ['gift', 'live_room']
    list_filter = ['gift']


class RoomUserListAdmin(admin.ModelAdmin):
    list_display = ['user', 'live_room', 'weight']
    search_fields = ['user', 'live_room']
    list_filter = ['live_room']


@admin.register(Label)
class LabelAdmin(admin.ModelAdmin):
    list_display = ['name']
    search_fields = ['name']


@admin.register(SonLabel)
class SonLabelAdmin(admin.ModelAdmin):
    list_display = ['name', 'father_label']
    search_fields = ['father_label', 'name']
    list_filter = ['father_label']


admin.site.register(LiveRoom, LiveRoomAdmin)
admin.site.register(Gift, GiftAdmin)
admin.site.register(ReceiveGift, ReceiveGiftAdmin)
admin.site.register(RoomUserList, RoomUserListAdmin)
